home *** CD-ROM | disk | FTP | other *** search
- Path: news.edge.net!news
- From: cmclaur@edge.net (Chris McLaurin)
- Newsgroups: comp.lang.c++
- Subject: Please help, file read and write problem.
- Date: Mon, 08 Jan 1996 21:11:12 GMT
- Organization: The Edge
- Message-ID: <4crq6o$30l@excalibur.edge.net>
- NNTP-Posting-Host: ip152.nash.edge.net
- X-Newsreader: Forte Free Agent 1.0.82
-
- struct stub {
- int delete_flag; //enum DeleteFlag ACTIVE/DELETED
- int recordnum; //a sequential number in the file
- } rec;
-
- dfile is opened and correctly positioned.
-
- when rec.recordnum = 1 to 10, the following works fine.
- dfile.write((char *) &rec, sizeof rec) ;
- --- and ---
- dfile.read((char *) &rec, sizeof rec);
-
- ------------------------------------------------------------------------------------------
-
- if rec.recordnum = 11 then a hex dump of
- dfile.write((char *) &rec, sizeof rec) ;
- looks correct, but:
- dfile.read((char *) &rec, sizeof rec);
- cout << rec.recordnum;
- consistantly returns:
- 2895
-
- any time rec.recordnum >= 11 the numbers read into rec.recordnumber
- are incorrect.
-
- Please help ...
-
- Chris McLaurin
- Open Systems Integrators, Inc.
- http://edge.edge.net/~cmclaur | PGP available via finger or URL
- "Success is in the effort." -clm
-
-